<template>
  <div>
    <div class="banner" @click="handleBannerShow">
      <img
        class="banner-img"
        :src="bannerImg"
        alt=""
      />
      <div class="banner-info">
        <div class="banner-title">大连圣亚海洋世界（AAAA景区）</div>
        <div class="banner-number">
          <span class="iconfont banner-icon">&#xe692;</span>{{bannerImgs.length}}
        </div>
      </div>
    </div>
    <!-- 一开始隐藏起来，再出现swiper计算高度有问题  @click.native="handleBannerHide" -->
    <fade-animation>
        <comment-gallery v-show="isShowGallery" :imgs="bannerImgs" @close="handleBannerHide"></comment-gallery>
    </fade-animation>
  </div>
</template>

<script>
import CommentGallery from 'common/gallery/gallery'
import FadeAnimation from 'common/fade/Fade'

export default {
  name: 'DetailBanner',
  components: {CommentGallery, FadeAnimation},
  props: {
    sightName: String,
    bannerImg: String,
    bannerImgs: Array
  },
  data() {
    return {
      imgs: [
        'https://imgs.qunarzz.com/sight/p0/1409/19/adca619faaab0898245dc4ec482b5722.jpg_250x250_0fc722c0.jpg',
        'https://images4.c-ctrip.com/target/0200112000826tv9iD26A_D_280_280_R5.jpg',
        'https://youimg1.c-ctrip.com/target/01033120008r4sn4pACB9_R_238_268.jpg'
      ],
      isShowGallery: false
    }
  },
  methods: {
    handleBannerShow() {
      this.isShowGallery = true
    },
    handleBannerHide() {
      this.isShowGallery = false
    }
  }
}
</script>

<style lang="stylus" scoped>
.banner {
  position: relative;
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;

  .banner-img {
    width: 100%;
  }

  .banner-info {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    line-height: 0.6rem;
    color: #fff;
    background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));

    .banner-title {
      flex: 1;
      font-size: 0.32rem;
      padding: 0 0.2rem;
    }

    .banner-number {
      height: 0.32rem;
      line-height: 0.32rem;
      margin-top: 0.14rem;
      padding: 0 0.4rem;
      border-radius: 0.2rem;
      background: rgba(0, 0, 0, 0.8);
      font-size: 0.24rem;

      .banner-icon {
        font-size: 0.24rem;
      }
    }
  }
}
</style>
